from lib.config.index import sensor_config
from lib.sensors.lm35 import LM35
from lib.sensors.max98357 import Max98357
import time

lm35_config = sensor_config.get_sensor("LM35")
pin = lm35_config["pin"]
lm35 = LM35(pin)

max98357_config = sensor_config.get_sensor("MAX98357")
sck = max98357_config["sck"]
ws = max98357_config["ws"]
sd = max98357_config["sd"]
max98357 = Max98357(sck, ws, sd)

while True:
    c = lm35.read()
    print(f"{c} C")
    text = f"现在的温度是 {c} 度"
    max98357.network_play(text)
    time.sleep(10)
